////////////////////////////////////////////////////////////////////////////////
//File:					UglyTexture.h
//Author:				Kesitem
//This file is part of UglyProject.
//See UglyProject.txt for copyright informations.
////////////////////////////////////////////////////////////////////////////////
#ifndef __UGLYTEXTURE_H__
#define __UGLYTEXTURE_H__

#include "UglyCore.h"

namespace Ugly
{

/**
 * \brief Texture.
 */
class Texture
{
public:

    /**
     * \brief Constructor.
     */
    Texture();

    /**
     * \brief Destructor.
     */
    virtual ~Texture();

    /**
     * \brief Create texture from file.
     *
     * \param   _Filename   File name.
     * \return False, if error.
     */
    bool createFromFile(const std::string &_Filename);

    /**
     * \brief Destroy texture.
     */
    void destroy();

    /**
     * \brief bind the texture.
     */
    void bind();

    /**
     * \brief Unbind the texture.
     */
    void unbind();

private:

    /**
     * \brief Swap a SDL surface to match usual texture.
     *
     * \param   sourceSurface  Surface to swap.
     * \return Swaped surface.
     */
    SDL_Surface *swapTexture(SDL_Surface *sourceSurface) const;

private:

    /**
     * Texture id.
     */
    GLuint mId;
    /**
     * File name.
     */
    std::string mFilename;
};

}//namespace Ugly

#endif//__UGLYTEXTURE_H__
